using B.S.XZYData.ErrorCode;
using MediatR;
using System.Collections.Generic;

namespace B.S.XZYData.Api.Wrter.Application.Command.Route
{
    /// <summary>
    /// 保存工艺路线命令（主表+子表一起保存）
    /// </summary>
    public class SaveRouteCommand : IRequest<ApiResult<int>>
    {
        /// <summary>
        /// 工艺路线ID（0表示新增，>0表示编辑）
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 工艺路线编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 工艺路线名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 开启审批
        /// </summary>
        public bool EnableApproval { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 操作人
        /// </summary>
        public string OperateBy { get; set; }

        /// <summary>
        /// 工序列表
        /// </summary>
        public List<SaveRouteStepCommand> Steps { get; set; } = new List<SaveRouteStepCommand>();
    }

    /// <summary>
    /// 保存工艺路线工序命令
    /// </summary>
    public class SaveRouteStepCommand
    {
        /// <summary>
        /// 工序ID（0表示新增，>0表示编辑）
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 工序编号
        /// </summary>
        public string ProcessCode { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        public string ProcessName { get; set; }

        /// <summary>
        /// 报工配比
        /// </summary>
        public decimal? Ratio { get; set; }

        /// <summary>
        /// 报工权限(逗号分隔的角色)
        /// </summary>
        public string? ReportingPermissions { get; set; }

        /// <summary>
        /// 不良品项列表(管道分隔的ID\描述)
        /// </summary>
        public string? DefectiveItemList { get; set; }

        /// <summary>
        /// 测试字段1
        /// </summary>
        public string? TestField1 { get; set; }

        /// <summary>
        /// 测试字段2
        /// </summary>
        public string? TestField2 { get; set; }

        /// <summary>
        /// 是否删除（用于标识需要删除的工序）
        /// </summary>
        public bool IsDeleted { get; set; }
    }
} 